package com.xuan.bigdog.lib.chat.enums;

/**
 * 群聊或者单聊
 * 
 * @author xuan
 */
public enum DGMessageToType {
	// 1：单聊、2：群聊
	USER(1), GROUP(2);

	private int value;

	DGMessageToType(int value) {
		this.value = value;
	}

	public int getValue() {
		return value;
	}

	public static DGMessageToType valueOf(int value) {
		DGMessageToType messageToType = null;
		switch (value) {
		case 1:
			messageToType = USER;
			break;
		case 2:
			messageToType = GROUP;
		default:
			messageToType = USER;// 默认就算单聊
			break;
		}
		return messageToType;
	}

	public String getDescription() {
		String desc = null;
		switch (this) {
		case USER:
			desc = "单聊";
			break;
		case GROUP:
			desc = "群聊";
			break;
		default:
			desc = "单聊";// 默认就算单聊
			break;
		}
		return desc;
	}

	@Override
	public String toString() {
		return getDescription();
	}

	public boolean equals(DGMessageToType messageToType) {
		if (null == messageToType) {
			return false;
		}
		return value == messageToType.value;
	}

}
